package com.ch.home.testMapper;

import com.ch.home.bean.User;
import com.ch.home.mapper.userMessageMapper.UserMapper;
import com.ch.home.service.serviceImpl.userServiceImpl.UserServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.LinkedList;

/**
 * Created by CHEN on 2019/8/17.
 */

//@RunWith(SpringJUnit4ClassRunner.class)

@RunWith(SpringRunner.class)
@SpringBootTest
public class testUser {
    @Autowired
    UserServiceImpl userService;
    @Autowired
    UserMapper userMapper;

    @Test
    public void testselectListByCondition() {

        User user = new User();
//        user.setAge(14);
//        user.setGender(1);
        user.setIntegral(Long.valueOf(1));
        LinkedList<User> users = userMapper.selectListByCondition(user);
        for (User u : users
                ) {
            System.out.println(u);
        }
    }

    @Test
    public void testListUser() {
        LinkedList<User> users = userService.listUser( );
        for (User u : users
                ) {
            System.out.println(u);
        }
    }

    @Test
    public void testothers() {
        User user = new User();
//        user.setUsername("椰子奶糖2");
//        user.setUsername("椰子奶糖21");
//        user.setUserId((long) 1);
//        user.setUserId((long) 19);
        user.setQQ("1027740945");
        System.out.println(userMapper.judgeExists(user));
    }


}
